<?php

namespace App\model;

use support\Model;

class Role extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'role';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';

    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = true;

    protected $dateFormat = 'U';

    // 定义一个访问器，用于格式化输出
    public function getCreatedAtAttribute($value)
    {
        return date('Y-m-d H:i:s', strtotime($value));
    }

    public function getRoleInfoByUuidRoleId($uuid, $role_id, $job_id)
    {
        $conf = $this->where('uuid', $uuid)->where('role_id', $role_id)->where('job_id', $job_id)->first();
        return $conf ? $conf->toArray() : [];
    }


}
